package com.example.demo.web;

import com.example.demo.entity.SeataOrder;
import com.example.demo.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    @PostMapping("create")
    public ResponseEntity<SeataOrder> create(Integer userId,String commodityCode,Integer orderCount){
        SeataOrder order = orderService.create(userId, commodityCode, orderCount);
        return ResponseEntity.ok(order);
    }
}
